#ifndef MATERIAL_H_
#define MATERIAL_H_

#include <vmath.h>
#include "texture.h"

struct mattr {
	char *name;
	vec4_t val;
	char *texname;
	mat4_t texmat;

	struct texture *tex;	/* cached texture pointer */

	struct mattr *next;
};

struct material;

struct material *mat_create(void);
void mat_free(struct material *m);

int mat_set_name(struct material *m, const char *name);
const char *mat_get_name(struct material *m);

int mat_set_shader(struct material *m, const char *sdr);
const char *mat_get_shader_name(struct material *m);
struct shader *mat_get_shader(struct material *m);

int mat_add_attr(struct material *m, struct mattr *attr);
struct mattr *mat_get_attr(struct material *m, const char *attr_name);

vec4_t mat_attr_value(struct material *m, const char *attr_name, vec2_t tc, vec4_t def);

int mattr_set_name(struct mattr *ma, const char *name);
int mattr_set_texture(struct mattr *ma, const char *tex);

#endif	/* MATERIAL_H_ */
